import {
  setToken,
  getToken
} from '@/libs/util'

export default {
  state: {
    wxName: '',
    openid: '',
    mobile: '',
    wxImage: '',
    managerName:'',
    token: '',
    addr: '',
    shopName: ''
  },
  mutations: {
    setWxOpenId(state, result) {
      state.openid = result.openid;
      state.wxImage = result.wxImage;
      state.wxName = result.wxName;
    },
    setWxUserInfo(state, user_info) {
      state.wxName = user_info.wxName;
      state.openid = user_info.openid;
      state.mobile = user_info.mobile;
      state.wxImage = user_info.wxImage;
      state.token = user_info.token;
      state.addr = user_info.addr;
      state.shopName = user_info.shopName;
      setToken(user_info.token)
    },
  }
}
